<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>

    <groupId>ru.playa.keycloak</groupId>
    <artifactId>keycloak-russian-providers</artifactId>
    <version>1.0.50-SNAPSHOT</version>
    <modelVersion>4.0.0</modelVersion>
    <packaging>jar</packaging>

    <name>Keycloak identity providers for Russian Social Networks</name>
    <description>Yandex.Ru, Vk.Com, Mail.Ru and Ok.ru identity providers for Keycloak</description>
    <url>https://github.com/playa-ru/keycloak-russian-providers</url>

    <developers>
        <developer>
            <name>Anatoliy Pokhresniy</name>
            <email>a.pohresniy@playa.ru</email>
            <organization>Playa.Ru</organization>
            <organizationUrl>https://playa.ru</organizationUrl>
        </developer>
        <developer>
            <name>Sergey Bezrukov</name>
            <email>s.bezrukov@playa.ru</email>
            <organization>Playa.Ru</organization>
            <organizationUrl>https://playa.ru</organizationUrl>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven.compiler.release>17</maven.compiler.release>

        <version.javadoc.plugin>2.10.1</version.javadoc.plugin>
        <version.compiler.plugin>3.11.0</version.compiler.plugin>
        <version.deploy.plugin>2.8.2</version.deploy.plugin>
        <version.source.plugin>2.4</version.source.plugin>
        <version.release.plugin>2.5.3</version.release.plugin>
        <version.assembly.plugin>3.1.0</version.assembly.plugin>
        <version.pmd.plugin>3.9.0</version.pmd.plugin>
        <version.checkstyle.plugin>3.0.0</version.checkstyle.plugin>
        <version.surefire.plugin>2.22.0</version.surefire.plugin>

        <version.keycloak>24.0.1</version.keycloak>
    </properties>

    <scm>
        <url>scm:git:git@github.com:playa-ru/keycloak-russian-providers.git</url>
        <developerConnection>scm:git:git@github.com:playa-ru/keycloak-russian-providers.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>net.minidev</groupId>
            <artifactId>json-smart</artifactId>
            <version>2.5.0</version>
        </dependency>

        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-services</artifactId>
            <version>${version.keycloak}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-server-spi</artifactId>
            <version>${version.keycloak}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-server-spi-private</artifactId>
            <version>${version.keycloak}</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${version.compiler.plugin}</version>
            </plugin>

            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <useSystemClassLoader>false</useSystemClassLoader>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.surefire.plugin}</version>
                <configuration>
                    <useSystemClassLoader>false</useSystemClassLoader>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${version.checkstyle.plugin}</version>

                <configuration>
                    <consoleOutput>true</consoleOutput>
                    <configLocation>checkstyle.xml</configLocation>
                </configuration>

                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${version.pmd.plugin}</version>

                <configuration>
                    <sourceEncoding>utf-8</sourceEncoding>
                    <minimumTokens>100</minimumTokens>
                    <targetJdk>1.8</targetJdk>
                    <rulesets>
                        <ruleset>pmd.xml</ruleset>
                    </rulesets>
                    <excludeRoots>
                        <excludeRoot>target/generated-sources</excludeRoot>
                    </excludeRoots>
                    <analysisCache>true</analysisCache>
                </configuration>

                <executions>
                    <execution>
                        <id>pmd-check</id>
                        <phase>test</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <excludeFromFailureFile>exclude-pmd.properties</excludeFromFailureFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>cpd-check</id>
                        <phase>test</phase>
                        <goals>
                            <goal>cpd-check</goal>
                        </goals>
                        <configuration>
                            <excludeFromFailureFile>exclude-cpd.properties</excludeFromFailureFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${version.deploy.plugin}</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>

                <executions>
                    <execution>
                        <id>attach-javadoc</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${version.source.plugin}</version>
                <executions>
                    <execution>
                        <id>attach-source</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
        </plugins>

    </build>

    <distributionManagement>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>docker</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>dockerfile-maven-plugin</artifactId>
                        <version>1.4.13</version>
                        <configuration>
                            <repository>playaru/${artifactId}</repository>
                            <tag>${version.keycloak}</tag>
                            <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
                            <buildArgs>
                                <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
                                <PLAYA_RU_GITHUB_TOKEN>${token.github}</PLAYA_RU_GITHUB_TOKEN>
                            </buildArgs>
                        </configuration>
                        <executions>
                            <execution>
                                <id>default</id>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
